// 枚举常量中英文映射
export const UserRoleMap = {
  STUDENT: '学生',
  ENTERPRISE: '企业',
  ADMIN: '管理员'
}

export const UserStatusMap = {
  PENDING: '待审核',
  NORMAL: '正常',
  DISABLED: '禁用'
}

export const PositionStatusMap = {
  PUBLISHED: '已发布',
  DEPRECATED: '已废除'
}

export const ApplicationStatusMap = {
  PENDING: '待处理',
  REJECTED: '已拒绝',
  INTERVIEW_INVITED: '已邀请面试'
}

export const InterviewStatusMap = {
  PENDING_CONFIRM: '待确认',
  ACCEPTED: '已接受',
  REJECTED: '已拒绝'
}

// 反向映射（数字转英文常量）
export const UserRoleNum2Str = {
  1: 'STUDENT',
  2: 'ENTERPRISE',
  3: 'ADMIN'
}
export const UserStatusNum2Str = {
  0: 'PENDING',
  1: 'NORMAL',
  2: 'DISABLED'
}
export const PositionStatusNum2Str = {
  0: 'PUBLISHED',
  1: 'DEPRECATED'
}
export const ApplicationStatusNum2Str = {
  0: 'PENDING',
  1: 'REJECTED',
  2: 'INTERVIEW_INVITED'
}
export const InterviewStatusNum2Str = {
  0: 'PENDING_CONFIRM',
  1: 'ACCEPTED',
  2: 'REJECTED'
}

// 枚举常量字符串转数字映射（处理后端返回的数据）
export const UserRoleStr2Num = {
  'STUDENT': 1,
  'ENTERPRISE': 2,
  'ADMIN': 3
}
export const UserStatusStr2Num = {
  'PENDING': 0,
  'NORMAL': 1,
  'DISABLED': 2
}
export const PositionStatusStr2Num = {
  'PUBLISHED': 0,
  'DEPRECATED': 1
}
export const ApplicationStatusStr2Num = {
  'PENDING': 0,
  'REJECTED': 1,
  'INTERVIEW_INVITED': 2
}
export const InterviewStatusStr2Num = {
  'PENDING_CONFIRM': 0,
  'ACCEPTED': 1,
  'REJECTED': 2
}

// 工具函数：将后端返回的枚举常量转换为数字
export const convertStatusToNumber = (status, type = 'application') => {
  if (typeof status === 'number') return status
  if (typeof status === 'string') {
    switch (type) {
      case 'application':
        return ApplicationStatusStr2Num[status] ?? 0
      case 'interview':
        return InterviewStatusStr2Num[status] ?? 0
      case 'user':
        return UserStatusStr2Num[status] ?? 0
      case 'position':
        return PositionStatusStr2Num[status] ?? 0
      default:
        return 0
    }
  }
  return 0
}

export const menuMap = {
  STUDENT: [
    { path: '/student', label: '学生首页', icon: 'House' },
    { path: '/student/enterprises', label: '企业列表', icon: 'OfficeBuilding' },
    { path: '/student/positions', label: '岗位浏览', icon: 'List' },
    { path: '/student/applications', label: '我的投递', icon: 'Document' },
    { path: '/student/interviews', label: '面试邀请', icon: 'Message' },
    { path: '/student/resume', label: '我的简历', icon: 'User' },
    { path: '/student/info', label: '我的信息', icon: 'Setting' },
  ],
  ENTERPRISE: [
    { path: '/enterprise/positions', label: '岗位管理', icon: 'List' },
    { path: '/enterprise/applications', label: '申请处理', icon: 'Document' },
    { path: '/enterprise/interviews', label: '面试管理', icon: 'Message' },
    { path: '/enterprise/invite', label: '邀请学生', icon: 'User' },
    { path: '/enterprise/info', label: '企业信息', icon: 'Setting' },
  ],
  ADMIN: [
    { path: '/admin', label: '管理员首页', icon: 'House' },
    { path: '/admin/audit', label: '用户审核', icon: 'User' },
    { path: '/admin/applications', label: '申请管理', icon: 'Document' },
    { path: '/admin/interviews', label: '面试管理', icon: 'Message' },
    { path: '/admin/students', label: '学生列表', icon: 'Avatar' },
    { path: '/admin/enterprises', label: '企业列表', icon: 'OfficeBuilding' },
    // { path: '/profile/info', label: '管理员信息', icon: 'User' },
  ]
} 